/*
 * @Author: wuyuxin
 * @Date: 2022-01-09 16:56:36
 * @LastEditors: wuyuxin
 * @LastEditTime: 2022-01-10 11:39:57
 * @Description: 
 */
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';

function render(props) {
  ReactDOM.render(
    <React.StrictMode>
      <App />
    </React.StrictMode>,
    // document.getElementById('root')
    props && props.container ? props.container.querySelector('#root') : document.getElementById('root')
  );
}
// if (window.__POWERED_BY_QIANKUN__) { // 动态添加 publicPath
//   __webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
// }
if (!window.__POWERED_BY_QIANKUN__) { // 默认独立运行
  console.log('window.__POWERED_BY_QIANKUN__', window.__POWERED_BY_QIANKUN__)
  render()
}

export async function bootstrap(props) {
  console.log('react app bootstraped');
}

export async function mount(props) {
  console.log('mount')
  render(props)
}

export async function unmount(props) {
  console.log('unmount')
  ReactDOM.unmountComponentAtNode(props && props.container ? props.container.querySelector('#root') : document.getElementById('root'))
}
